package com.example.springbootrabbitmq.config;

import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;

/**
 * tang
 * 应用启动后，会连接到rabbitmq创建对应的队列等
 */

@Service
public class RabbitMqBaseInitService {

    @Bean
    public Queue helloQueue() {
        return new Queue("helloQueue");
    }

    @Bean
    public Queue userQueue() {

        /** 设置消息的ttl
         Map map=new HashMap<>();
         map.put("x-message-ttl",6000);
         return new Queue("userQueue",true,false,false,map);
         */

        //默认durable=true,exclusive=false, autoDelete=false
        return new Queue("userQueue");
    }


}
